<template>
  <div id="index">
    <dv-full-screen-container class="bg">
      <dv-loading v-if="loading">页面加载中...</dv-loading>
      <div v-else class="host-body">
        <div class="d-flex jc-center">
          <div class="title">
            <span class="title-text">智慧水利大数据可视化平台</span>
          </div>
          <div class="timeShow">
            <span>当前时间:{{ dateYear }} {{ dateWeek }} {{ dateDay }}</span>
          </div>
        </div>
        <section class="riveroutline">
          <EchartViews/>
        </section>
        <section class="mainBox">
          <div class="column">
            <div class="panel bar">
              <h2>水质指标监测</h2>
              <div class="chart">
                <LeftUp/>
              </div>
              <div class="panel-footer"></div>
            </div>
            <div class="panel leftdownbar">
              <h2>降水量监测</h2>
              <div class="leftdown">
                <LeftDown/>
              </div>
              <div class="panel-footer"></div>
            </div>
          </div>
          <div class="column">
            <div class="placehold">
            </div>
          </div>
          <div class="column">
            <div class="panel bar">
              <h2>水质指标监测</h2>
              <div class="chart leftup">
                <LeftUp/>
              </div>
              <div class="panel-footer"></div>
            </div>
            <div class="panel bar">
              <h2>水质指标监测</h2>
              <div class="chart leftup">
                <LeftUp/>
              </div>
              <div class="panel-footer"></div>
            </div>
          </div>
        </section>
      </div>
    </dv-full-screen-container>
  </div>
</template>

<script>
import {formatTime} from '../utils/index.js'
import LeftUp from "./LeftUp";
import LeftDown from "./LeftDown";
import EchartViews from "_c/echart/center/centerRiverOutline";

export default {
  data() {
    return {
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
    };
  },
  components: {EchartViews, LeftUp, LeftDown},
  mounted() {
    this.timeFn();
    this.cancelLoading();
  },
  methods: {
    timeFn() {
      setInterval(() => {
        let dateT = new Date();
        this.dateDay = formatTime(dateT, 'HH: mm: ss');
        this.dateYear = formatTime(dateT, 'yyyy-MM-dd');
        this.dateWeek = this.weekday[dateT.getDay()];
      }, 1000)
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    }
  }
};
</script>

<style lang="scss">
@import '../assets/scss/index.scss';
</style>